package com.learn.docker_demo.controller;

import com.learn.docker_demo.pojo.User;
import com.learn.docker_demo.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author DJJ_F
 * @version 1.0
 * @date 2025/07/29
 * @description
 */
@RestController
public class UserController {
    @Resource
    private UserService userService;
    @GetMapping("/user/addUser")
    public String addUser() {
        User user = new User();
        user.setUsername("djf2077");
        user.setPhone("1008575");
        user.setPassword("fdfiaijdfo");

        userService.addUser(user);
        return "ok";
    }
    @GetMapping("/user/getUser")
    public User getUserById(@RequestParam("id") Integer id) {
        return userService.getUserById(id);
    }
}
